<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>档案鉴定页面</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <jsp:include page="/inc/head.jsp" flush="true"/>
    <jsp:include page="/inc/footer.jsp" flush="true"/>
    <!-- picker -->
    <script src="${basePath}/js/devPublic.js"></script>
    <script src="${basePath}/js/My97DatePicker/WdatePicker.js"></script>
    <script src="${basePath }/js/tip.js"></script>
</head>
<style media="print">
    @page {
        size: auto;  /* auto is the initial value */
        margin: 0mm; /* this affects the margin in the printer settings */
    }
    /*#appraisalArchiveModel {*/
        /**/
    /*}*/
    .modal-content {
        height: 400px!important;
    }
</style>
<body class="hold-transition skin-blue sidebar-mini" style="overflow: hidden;">
<!-- Main content -->
<section class="content">
    <div id="toolbar" class="btn-group" style="margin-bottom: 10px">
           <%-- <button id="btn_import" type="button" class="btn btn-default" onClick ="storageTimeAction()">
                <span class="glyphicon glyphicon-export" aria-hidden="true"></span>保管期限到期列表
            </button>--%>
        <button id="btn_mount" type="button" class="btn btn-default" onClick ="storageSecretAction()">
            <span class="glyphicon glyphicon-paperclip" aria-hidden="true"></span>保密期限到期待鉴定列表
        </button>
       <button id="btn_submit" type="button" class="btn btn-default" onclick="checkHistoryApprisalAction()">
            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>鉴定登记列表
        </button>
    </div>
    <div class="panel panel-default" id="dataMsg">
        <div class="panel-heading">
            <h3 class="panel-title">数据信息</h3>
        </div>
        <div class="table-left">
            <table id="table">
            </table>
        </div>
    </div>
    <jsp:include page="/WEB-INF/jsp/appraisalArchive/appraisalTableModal.jsp" flush="true"/>
</section>
</body>
<script>
    var $table = $('#table');
    /**
     *   解析url,显示待鉴定的卷件信息
     */
    $(function () {
        var type="${type}";
        var id="${id}";
        if (typeof id == "undefined" || id == null || id == "") {
            //所有带鉴定的档案列表
            findNeedAppraisalList();
        } else {
            //鉴定流程
            findJudAndItemMessage(id, type);
        }
    });
    function findJudAndItemMessage(id, type) {
        var url = "${basePath}/pcwindow/searchArchiveMessage?id=" + id + '&type=' + type;
        if (type == 0) {
            //鉴定卷
            appraisalManagerAction(url, judColumn);
        } else if (type == 1) {
            appraisalManagerAction(url, itemColumns);
        } else {
            appraisalManagerAction(url, itemSinColumns);
        }
    }
    /**
     *   显示需要鉴定的档案列表
     */
    function findNeedAppraisalList() {
        var url = "${basePath}/pcwindow/showAllAppraisalList";
        appraisalManagerAction(url, itemComplexColumns);
    }
    function storageSecretAction() {
        $('#table').bootstrapTable('destroy');
        var url = "${basePath}/pcwindow/showAllAppraisalList";
        appraisalManagerAction(url, itemComplexColumns);
    }
    /************************************卷件信息Table（开始）****************************/
    function appraisalManagerAction(urla, columns) {
        $table.bootstrapTable({
            url: urla,
            striped: true,
            // height:613,
            //search: false,
            //showRefresh: false,
            //showColumns: false,
            minimumCountColumns: 2,
            clickToSelect: true,//是否启用点击选中行
            singleSelect: true,
            detailView: false,
            detailFormatter: 'detailFormatter',
            pagination: true,
            pageSize: 50,
            pageList: [50, 100],
            smartDisplay: false,
            paginationLoop: true,
            sidePagination: 'server',
            silentSort: false,
            escape: true,
            searchOnEnterKey: true,
            maintainSelected: true,
            columns: columns,
            onLoadSuccess:function(data){
                //无数据隐藏分页
                if(data && data.total == 0){
                    $('.fixed-table-pagination').hide()
                }
            }

        });
        $('#table').bootstrapTable('resetView',{height:setHeight()});
        // console.log(setHeight())
    }
    var judColumn = [
        {field: 'ck', checkbox: true},
        {field: 'volClass', title: '案卷类型', formatter: 'arcClassSinFormatter'},
        {field: 'volTitle', title: '题名', align: 'center'},
        {field: 'volStorageTime', title: '保管期限', formatter: 'storageTimeSinFormatter'},
        {field: 'volCaseNum', title: '档号', align: 'center'},
        {field: 'volArchiveUnit', title: '归档单位', formatter: 'orgIdConversionNameFormatter'},
        {field: 'volAuditLeader', title: '审计组长', sortable: true, align: 'center'},
        {field: 'volSecret', title: '密级', formatter: 'secretLevelFormatter'},
        {field: 'volStatus', title: '档案状态', align: 'center', formatter: 'volStatusFormatter'},
        {field: 'volArchiveYear', title: '归档年度', align: 'center'},
        {field: 'volArchiveDate', title: '归档日期', align: 'center', formatter: 'timeFormatter'},
        {
            field: 'action',
            title: '操作',
            align: 'center',
            formatter: 'volumeActionFormatter',
            events: 'actionEvents',
            clickToSelect: true
        }
    ]
    var itemColumns = [
        {field: 'ck', checkbox: true},
        {field: 'itemTemporary', title: '单元号', align: 'center'},
        {field: 'itemTitle', title: '题名', align: 'center'},
        {field: 'itemCreateTime', title: '发文日期', align: 'center'},
        {field: 'itemName', title: '文号', align: 'center'},
        {field: 'itemRespons', title: '责任者', align: 'center'},
        {field: 'itemSecret', title: '密级', formatter: 'secretLevelFormatter'},
        {field: 'itemStr1', title: '档号',  align: 'center'},
        {field: 'itemStr11Date', title: '归档日期', align: 'center', formatter: 'timeFormatter'},
        {
            field: 'action',
            title: '操作',
            align: 'center',
            formatter: 'itemActionFormatter',
            events: 'actionEvents',
            clickToSelect: false
        }
    ]
    var itemSinColumns = [
        {field: 'ck', checkbox: true},
        {field: 'itemTemporary', title: '单元号', align: 'center'},
        {field: 'itemTitle', title: '题名', align: 'center'},
        {field: 'itemCreateTime', title: '发文日期', align: 'center'},
        {field: 'itemName', title: '文号', align: 'center'},
        {field: 'itemRespons', title: '责任者', align: 'center'},
        {field: 'itemSecret', title: '密级', formatter: 'secretLevelFormatter'},
        {field: 'itemStr1', title: '档号', align: 'center'},
        {field: 'itemStr1Date', title: '归档日期', align: 'center', formatter: 'timeFormatter'},
        {
            field: 'action',
            title: '操作',
            align: 'center',
            formatter: 'itemSinActionFormatter',
            events: 'actionEvents',
            clickToSelect: false
        }
    ]
    var apprColumns = [
        {field: 'ck', checkbox: true},
        {field: 'apprCode', title: '鉴定工作表编号', align: 'center'},
        {field: 'apprVolClass', title: '档案分类', formatter: 'arcClassSinFormatter'},
        {field: 'apprNo', title: '档号', align: 'center'},
        {field: 'apprTitle', title: '题名', align: 'center'},
        {field: 'apprItemNum', title: '件数', align: 'center'},
        {field: 'apprStorageTime', title: '保管期限', formatter: 'storageTimeSinFormatter'},
        {field: 'apprSecret', title: '密级', formatter: 'secretLevelFormatter'},
        {field: 'apprArcDate', title: '归档日期', align: 'center', formatter: 'dataFormatter'},
        {field: 'apprDate', title: '鉴定日期', align: 'center'},
        {field: 'apprOpinion', title: '意见', align: 'center'},
        {field: 'apprResult', title: '结论', formatter: 'apprStatusFormatter'},
        {
            field: 'action',
            title: '操作',
            align: 'center',
            formatter: 'apprActionFormatter',
            events: 'actionEvents',
            clickToSelect: false
        }
    ]
    var itemComplexColumns = [
        {field: 'ck', checkbox: true},
        {field: 'itemTemporary', title: '单元号', align: 'center'},
        {field: 'itemTitle', title: '题名', align: 'center'},
        {field: 'itemCreateTime', title: '发文日期', align: 'center'},
        {field: 'itemNum', title: '保管期限', align: 'center',formatter: 'storageTimeSinFormatter'},
        {field: 'itemName', title: '文号', align: 'center'},
        {field: 'itemRespons', title: '责任者', align: 'center'},
        {field: 'itemSecret', title: '密级', formatter: 'secretLevelFormatter'},
        {field: 'itemExp4', title: '保密期限',align: 'center'},
        {field: 'itemStr2', title: '档号', align: 'center'},
        {field: 'itemStr1Date', title: '归档日期', align: 'center', formatter: 'timeFormatter'},
        {
            field: 'action',
            title: '操作',
            align: 'center',
            formatter: 'itemComplexActionFormatter',
            events: 'actionEvents',
            clickToSelect: false
        }
    ]
    //格式化文件类型
    function arcClassSinFormatter(value, row, index){
        return archiveType[value];
    }
    //格式化保管期限
    function storageTimeSinFormatter(value, row, index){
        return storageTime[value];
    }
    //格式化密级
    function secretLevelFormatter(value, row, index){
        return secretLevel[value];
    }
    //格式化归档单位
    function orgIdConversionNameFormatter(value, row, index){
        return orgList[value];
    }
    /**
     *    卷状态显示按钮
     */
    function volStatusFormatter(value, row, index) {
        if (row.volStatus == 0) {
            return '<font style="color:dodgerblue;">正常</font>'
        }
        if (row.volStatus == 1) {
            return '<font style="color:grey;">鉴定中</font>'
        }
    }
    /**
     *    件状态显示按钮
     */
    function dataFormatter(value, row, index) {
        return formatshortDateTime(row.apprArcDate);
    }
    /**
     *    件状态显示按钮
     */
    function itemStatusFormatter(value, row, index) {
        if (row.itemStatus == 0) {
            return '<font style="color:dodgerblue;">正常</font>'
        }
        if (row.itemStatus == 1) {
            return '<font style="color:grey;">鉴定中</font>'
        }
    }

    /**
     *    鉴定状态显示按钮
     */
    function apprStatusFormatter(value, row, index) {
        if (row.apprResult == 0) {
            return '<font style="color:grey;">销毁</font>'
        }
        if (row.apprResult == 1) {
            return '<font style="color:grey;">移交</font>'
        }
        if (row.apprResult == 2) {
            return '<font style="color:grey;">续存</font>'
        }
        if (row.apprResult == 3) {
            return '<font style="color:grey;">解密</font>'
        }
    }

    /**
     *    格式化时间(格式YYYY-dd-MM HH:mm:ss)
     */
    function timeFormatter(value, row, index) {
        return formatshortDateTime(value);
    }

    /**
     *    卷操作按钮
     */
    function volumeActionFormatter(value, row, index) {
        return '<a style="color:#01579b;" href="javascript:void(0)" onclick="archAppraisalAction(' + row.volId + ',0 , '+ index +')" >发起鉴定</a>';
    }

    /**
     *    件操作按钮
     */
    function itemActionFormatter(value, row, index) {
        return '<a style="color:#01579b;" href="javascript:void(0)" onclick="archAppraisalAction(' + row.itemId + ',1 , '+ index +')" >发起鉴定</a>';
    }

    /**
     *    单件操作按钮
     */
    function itemSinActionFormatter(value, row, index) {
        return '<a style="color:#01579b;" href="javascript:void(0)" onclick="archSinItemAppraisalAction(' + row.itemId + ',2 )" >发起鉴定</a>';
    }
    /**
     *    综合操作按钮
     */
    function itemComplexActionFormatter(value, row, index) {
        if(row.itemExp5 == 1){
            return '<a style="color:#01579b;" href="javascript:void(0)" onclick="archAppraisalAction(' + row.itemId + ',1, '+ index +')" >发起鉴定</a>';
        }else{
            return '<a style="color:#01579b;" href="javascript:void(0)" onclick="archSinItemAppraisalAction(' + row.itemId + ',2 )" >发起鉴定</a>';
        }
    }

    /**
     *    鉴定操作按钮
     */
    function apprActionFormatter(value, row, index) {
        if (row.apprStatus == 0) {
            return '<a style="color:#01579b;" href="javascript:void(0)" onclick="editAppraisalAction(' + row.apprId + ', '+ index +')">填写鉴定结果</a>';
        } else {
            return '<a style="color:#01579b;" href="javascript:void(0)" onclick="checkAppraisalAction(' + row.apprId + ', '+ index +')" >打印鉴定结果</a>';
        }
    }
    /************************************卷件信息Table（结束）****************************/

    /************************************鉴定（开始）****************************/
    /**
     *    发起鉴定，加载卷信息
     */
    function archAppraisalAction(id, type,index) {
        var rows = $table.bootstrapTable('getData');
//        if (rows.length != 1) {
//            confirmEvent('请选择一条记录！');
//        } else {
        $("#arcType").val(type);
        if (type == 0) {
            $("#volId").val(id);
            var itemTotalNum = '';
            $.ajax({
                type: 'POST',
                url: '${basePath}/pcwindow/findItemNumById',
                dataType: "json",
                data: {
                    id: id,
                },
                async: false,
                success: function (data) {
                    if (data.length != 0) {
                        itemTotalNum = data;
                    }
                }
            });
            $("#apprType").val(archiveType[rows[index].volClass]);//档案分类
            $("#apprArcNum").val(rows[index].volCaseNum);//档号
            $("#apprArcTitle").val(rows[index].volTitle);//题名
            $("#apprItemTitleNum").val("");//文号
            $("#apprArcDate").val(formatshortDateTime(rows[index].volArchiveDate));//归档时间
            $("#apprArcOrg").val(orgList[rows[index].volArchiveUnit]);//归档单位
            $("#apprDeadline").val(storageTime[rows[index].volStorageTime]);//保管期限
            $("#apprArcSecret").val(secretLevel[rows[index].volSecret]);//密级
            $("#apprItemNum").val(itemTotalNum);//件数
            $("#apprPageNum").val(rows[index].volTotalPage);//页数
            $("#resultAppr").hide();
            $("#saveAppr").show();
            $('#appraisalArchiveModel').modal({
                keyboard: true
            });
        } else {
            $("#itemId").val(id);
            loadItemMessage(id);
        }
//        }
    }
    /**
     *    发起鉴定，加载卷内件信息
     */
    function loadItemMessage(id) {
        $.ajax({
            type: 'POST',
            url: '${basePath}/pcwindow/findArchiveMessageByItemId',
            dataType: "json",
            data: {
                itemId: id,
            },
            async: false,
            success: function (data) {
                if (data.length != 0) {
                    $("#apprType").val(archiveType[data[0].VOL_CLASS]);//档案分类
                    $("#apprArcNum").val(data[0].ITEM_STR1);//档号
                    $("#apprArcTitle").val(data[0].ITEM_TITLE);//题名
                    $("#apprItemTitleNum").val(data[0].ITEM_NAME);//文号
                    $("#apprArcDate").val(formatshortDateTime(data[0].ITEM_STR11_DATE));//归档时间
                    $("#apprArcOrg").val(orgList[data[0].VOL_ARCHIVE_UNIT]);//归档单位
                    $("#apprDeadline").val(storageTime[data[0].VOL_STORAGE_TIME]);//保管期限
                    $("#apprArcSecret").val(secretLevel[data[0].VOL_SECRET]);//密级
                    $("#apprItemNum").val("1");//件数
                    $("#apprPageNum").val(data[0].ITEM_PAGE);//页数
                    $("#resultAppr").hide();
                    $("#saveAppr").show();
                    $('#appraisalArchiveModel').modal({
                        keyboard: true
                    });
                }
            }
        });
    }

    /**
     *    发起鉴定，加载单件信息
     */
    function archSinItemAppraisalAction(id, type) {
        $("#itemId").val(id);
        $("#arcType").val(type);
        $.ajax({
            type: 'POST',
            url: '${basePath}/pcwindow/findArchiveMessageBySinItemId',
            dataType: "json",
            data: {
                itemId: id,
            },
            async: false,
            success: function (data) {
                if (data.length != 0) {
                    $("#apprType").val(archiveType[data[0].itemExp1]);//档案分类
                    $("#apprArcNum").val(data[0].itemStr1);//档号
                    $("#apprArcTitle").val(data[0].itemTitle);//题名
                    $("#apprItemTitleNum").val(data[0].itemName);//文号
                    $("#apprArcDate").val(formatshortDateTime(data[0].itemStr1Date));//归档时间
                    $("#apprArcOrg").val(orgList[data[0].itemExp2]);//归档单位
                    $("#apprDeadline").val(storageTime[data[0].itemNum]);//保管期限
                    $("#apprArcSecret").val(secretLevel[data[0].itemSecret]);//密级
                    $("#apprItemNum").val("1");//件数
                    $("#apprPageNum").val(data[0].itemPage);//页数
                    $("#resultAppr").hide();
                    $("#saveAppr").show();
                    $('#appraisalArchiveModel').modal({
                        keyboard: true
                    });
                }
            }
        });
    }
    /**
     *    保存鉴定信息
     */
    function saveSubmitButton() {
        var apprId = $("#apprId").val();//鉴定表Id
        var apprCode = $("#apprNum").val();//编号
        var apprApartment = $("#apprOrg").val();//编制单位
        var apprPerson = $("#apprPerson").val();//编制人
        var apprDate = $("#apprDate").val();//编制日期
        var volId = $("#volId").val();//卷主键
        var itemId = $("#itemId").val();//件主键
        var arcType = $("#arcType").val();//类型
        var apprOldDate = $("#apprOldDate").val();//已归档时间
        var apprRemarks = $("#apprRemarks").val();//备注
        var apprArcview = $("#apprOrgOpinion").val();//档案部门负责人意见
        var apprPersonview = $("#apprPersonOpinion").val();//鉴定人意见
        var apprExportsview = $("#apprExtOpinion").val();//鉴定专家组审核意见
        var apprLeaderview = $("#apprManOpinion").val();//分管领导审批意见
        var apprScope = $("#apprScope").find(":selected").val();//鉴定方式
        var apprResult = $("#apprResult").find(":selected").val();//鉴定结果
        var nextDeadline = $("#nextDeadline").find(":selected").val();//续存时间
        var data = {
            apprId: apprId,
            apprCode: apprCode,
            apprApartment: apprApartment,
            apprPerson: apprPerson,
            apprDate: apprDate,
            volId: volId,
            itemId: itemId,
            arcType:arcType,
            apprOldDate: apprOldDate,
            apprRemarks: apprRemarks,
            apprArcview: apprArcview,
            apprPersonview: apprPersonview,
            apprExportsview: apprExportsview,
            apprLeaderview: apprLeaderview,
            apprScope: apprScope,
            apprResult: apprResult,
            nextDeadline: nextDeadline,
        };
        $.ajax({
            url: '${basePath}/pcwindow/insertAppraisalMessage',
            data: data,
            type: "post",
            dataType: "json",
            success: function (result) {
                if (result.status != 200) {
                    confirmEvent('保存鉴定信息失败，请稍后再试!');
                } else {
                    confirmEvent('保存鉴定信息成功!');
                    $("#apprId").val(result.msg);
                    //刷新列表，显示鉴定登记记录
                    checkHistoryApprisalAction();
                }
            },
            error: function () {
                confirmEvent('系统开小差了，请稍后再试!');
            }
        })
    }
    /**
     *    查询历史鉴定信息
     */
    function checkHistoryApprisalAction() {
        $('#table').bootstrapTable('destroy');
        var url = "${basePath}/pcwindow/searchAppraisalMessage";
        appraisalManagerAction(url, apprColumns);
    }
    /**
     *    填写鉴定结果并保存
     */
    function editAppraisalAction(id,index) {
        loadApprMessage(id,index);
        $("#resultAppr").show();
        $("#saveAppr").hide();
        $('#appraisalArchiveModel').modal({
            keyboard: true
        });
    }
    /**
     *    查看鉴定结果
     */
    function checkAppraisalAction(id,index) {
        loadApprMessage(id,index);
        $("#resultAppr").hide();
        $("#saveAppr").hide();
        $('#appraisalArchiveModel').modal({
            keyboard: true
        });

    }
    /**
     *    加载鉴定信息——档案信息
     */
    function loadApprMessage(id,index) {
        var rows = $table.bootstrapTable('getData');
//        if (rows.length != 1) {
//            confirmEvent('请选择一条记录！');
//        } else {
            $("#apprPageNum").val(rows[index].apprPageNum);//页数
            $("#apprArcOrg").val(orgList[rows[index].apprArcOrg]);//归档单位
            $("#apprDeadline").val(storageTime[rows[index].apprStorageTime]);//保管期限
            $("#apprArcDate").val(formatshortDateTime(rows[index].apprArcDate));//归档时间
            $("#apprArcSecret").val(secretLevel[rows[index].apprSecret]);//密级
            $("#apprType").val(archiveType[rows[index].apprVolClass]);//档案分类
            $("#apprArcNum").val(rows[index].apprNo);//档号
            $("#apprArcTitle").val(rows[index].apprTitle);//题名
            $("#apprItemTitleNum").val(rows[index].apprItemName);//文号
            $("#apprItemNum").val(rows[index].apprItemNum);//件数
            loadApprMessageAction(rows[index].apprId);
//        }
    }
    /**
     *    加载鉴定信息——鉴定表信息
     */
    function loadApprMessageAction(id) {
        $.ajax({
            type: 'POST',
            url: '${basePath}/pcwindow/loadApprMessageByApprId',
            dataType: "json",
            data: {
                apprId: id,
            },
            async: false,
            success: function (data) {
                if (data.length != 0) {
                    $("#apprId").val(data.apprId);//鉴定表Id
                    $("#apprNum").val(data.apprCode);//编号
                    $("#apprOrg").val(data.apprApartment);//编制单位
                    $("#apprPerson").val(data.apprPerson);//编制人
                    $("#apprDate").val(data.apprDate);//编制日期
                    $("#apprOldDate").val(data.appExtrafive);//已保管时间
                    $("#apprRemarks").val(data.appExtrasix);//备注
                    $("#apprOrgOpinion").val(data.apprArcview);//档案部门负责人意见
                    $("#apprPersonOpinion").val(data.apprPersonview);//鉴定人意见
                    $("#apprExtOpinion").val(data.apprExportsview);//鉴定专家组审核意见
                    $("#apprManOpinion").val(data.apprLeaderview);//分管领导审批意见
                    $("#apprScope").val(data.appExtratwo);//鉴定方式
                    $("#apprResult").val(data.appExtrafour);//鉴定结果
                    $("#nextDeadline").val(data.appExtraThree);//续存时间
                }
            }
        });
    }
    /**
     *    填写鉴定结果
     */
    function apprSubmitButton() {
        var apprId = $("#apprId").val();//鉴定表Id
        var apprCode = $("#apprNum").val();//编号
        var apprApartment = $("#apprOrg").val();//编制单位
        var apprPerson = $("#apprPerson").val();//编制人
        var apprDate = $("#apprDate").val();//编制日期
        var apprOldDate = $("#apprOldDate").val();//已归档时间
        var apprRemarks = $("#apprRemarks").val();//备注
        var apprArcview = $("#apprOrgOpinion").val();//档案部门负责人意见
        var apprPersonview = $("#apprPersonOpinion").val();//鉴定人意见
        var apprExportsview = $("#apprExtOpinion").val();//鉴定专家组审核意见
        var apprLeaderview = $("#apprManOpinion").val();//分管领导审批意见
        var apprScope = $("#apprScope").find(":selected").val();//鉴定方式
        var apprResult = $("#apprResult").find(":selected").val();//鉴定结果
        var nextDeadline = $("#nextDeadline").find(":selected").val();//续存时间
        var data = {
            apprId: apprId,
            apprCode: apprCode,
            apprApartment: apprApartment,
            apprPerson: apprPerson,
            apprOldDate: apprOldDate,
            apprRemarks: apprRemarks,
            apprDate: apprDate,
            apprArcview: apprArcview,
            apprPersonview: apprPersonview,
            apprExportsview: apprExportsview,
            apprLeaderview: apprLeaderview,
            apprScope: apprScope,
            apprResult: apprResult,
            nextDeadline: nextDeadline,
        };
        $.ajax({
            url: '${basePath}/pcwindow/updateAppraisalMessage',
            data: data,
            type: "post",
            dataType: "json",
            success: function (result) {
                if (result.status != 200) {
                    confirmEvent('保存鉴定结果信息失败，请稍后再试!');
                } else {
                    confirmEvent('保存鉴定结果信息成功!');
                    $("#apprId").val(result.msg);
                    checkHistoryApprisalAction();
                }
            },
            error: function () {
                confirmEvent('系统开小差了，请稍后再试!');
            }
        })
    }
    /************************************鉴定（结束）****************************/
    // 手动隐藏模态框
    function handleModalHide(){
        $('#appraisalArchiveModel').modal('hide')
    }
    /************************************打印鉴定Table（开始）****************************/
    function printSubmitButton() {
        bindData();
        var headstr = "<html><head><title></title></head><body>";
        var footstr = "</body>";
        var newstr = document.getElementById("apprTableDiv").innerHTML;
        //获得 div 里的所有 html 数据
        var oldstr = document.body.innerHTML;
        document.body.innerHTML = headstr + newstr + footstr;
        window.print();
        document.body.innerHTML = oldstr;
        return false;
    }

    //将表单中手动填写的数据进行绑定，便于html()的时候获取到
    function bindData() {
        //搞定 type=text, 同时如果checkbox,radio,select>option的值有变化, 也绑定一下, 这里忽略button
        $("input,select option").each(function () {
            $(this).attr('value', $(this).val());
        });

        //搞定 type=checkbox,type=radio 选中状态
        $("input[type='checkbox'],input[type='radio']").each(function () {
            if ($(this).attr('checked'))
                $(this).attr('checked', true);
            else
                $(this).removeAttr('checked');
        });

        //搞定select选中状态
        $("select option").each(function () {
            if ($(this).attr('selected'))
                $(this).attr('selected', true);
            else
                $(this).removeAttr('selected');
        });

        //搞定 textarea
        $("textarea").each(function () {
            $(this).html($(this).val());
        });

    }
    /************************************打印鉴定Table（结束）****************************/

    /**
     * 表格高度自适应
     * @return
     * winTop 浏览器视口高度
     * header 顶部通栏
     * breadcrumb 面包屑
     * mainFooter 底部
     */
    function setHeight(){
        var winTop = $(window.top).height(),
            header = window.top.document.querySelector('.main-header').offsetHeight,
            breadcrumb =  window.top.document.querySelector('.breadcrumb').offsetHeight,
            mainFooter = window.top.document.querySelector('.main-footer').offsetHeight,
            toolbar = document.querySelector('#toolbar').offsetHeight;
        return winTop-header-breadcrumb-mainFooter-toolbar-60;
    }
</script>
</html>